﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LogicUniversityBiz
{
    public class MakeRequestControl
    {
        private EFFascade fascade = EFFascade.getEFFascade();

        public string getFromEmail(string id)
        {
            return fascade.getEmailOf(id);
        }

        public string getHeadEmail(string deptCode)
        {
            return fascade.getHeadEmail(deptCode);
        }
        public Employee getEmployeeInfo(string id)
        {
            return fascade.getEmployeeInfo(id);
        }
        public List<Catelogue> getAllCatelogueItems()
        {
            return fascade.getAllCatelogue();
        }

        public List<String> getCategory()
        {
            List<string> catList = new List<string>();
            

            foreach (string item in fascade.getAllCategory())
            {
                catList.Add(item);
            }

            return catList;
        }
<<<<<<< .mine

        public List<Catelogue> getCatelogueItem(string category)
        {
            if (category.Equals("All"))
            {
                return getAllCatelogueItems();
            }
            else
            {
                return fascade.getCatelogue(category);
            }
        }

        public string getDepartmentCodeOf(string empID)
        {
            return fascade.getDepartmentCode(empID);
        }

        public int recordRequisition(Requisition req)
        {
            try
            {
                fascade.insertRequisition(req);
            }
            catch (Exception e)
            {
                return 0;
            }

            return fascade.getLastRequisitionID();
        }

        public void recordRequisiitonDetail(Requisition_Detail reqDetail)
        {
            fascade.insertRequisitionDetail(reqDetail);
        }

        public List<RequisitionWithItemDetails> getRequestedItemDetails(int reqID)
        {
            return fascade.getRequisitionItemsDetail(reqID);
        }

        public string getEmpName(string id)
        {
            return fascade.getEmpName(id);
        }
=======

        public List<Catelogue> getCatelogueItem(string category)
        {
            return fascade.getCatelogue(category);
        }

        public string getDepartmentCodeOf(string empID)
        {
            return fascade.getDepartmentCode(empID);
        }

        public int recordRequisition(Requisition req)
        {
            try
            {
                fascade.insertRequisition(req);
            }
            catch (Exception e)
            {
                return 0;
            }

            return fascade.getLastRequisitionID();
        }

        public void recordRequisiitonDetail(Requisition_Detail reqDetail)
        {
            fascade.insertRequisitionDetail(reqDetail);
        }

        public List<RequisitionWithItemDetails> getRequestedItemDetails(int reqID)
        {
            return fascade.getRequisitionItemsDetail(reqID);
        }
>>>>>>> .r28
    }
}
